package pl.edu.agh.mobsys.soap;

/**
 * JobData contains data of a certain job
 *
 */
public class JobData implements Comparable<JobData> {

    public static final String DEFAULT_NAME = "Sleep Job";
    public static final String DEFAULT_COMMAND = "/bin/sleep";
    public static final String DEFAULT_ARGS = "20";

    private static int nextId = 0;
    
    private String name;
    private String command;
    private String args;
    private String aid;
    private int id;

    public static enum JobState {QUEUED,EXECUTING,PAUSED,FINISHED,CANCELLED};
    private JobState jobState;
    
    public JobData(String name, String command, String args){
        this.name = name;
        this.command = command;
        this.args = args;
        //this.aid = "urn:uuid:empty"; //inicjacja aid zadania dowolnym ciagiem znakow - piter
        this.jobState = JobState.QUEUED;
        this.id = nextId++;
    }

    public JobData(){
        name = "DummyName";
        command = "DummyCommand";
        args = "DummyArgs";
        aid = "DummyAid";
    }
    
    public String getArgs() {
        return args;
    }

    public String getCommand() {
        return command;
    }

    public String getName() {
        return name;
    }

//    public String getSendId() {
//        return _sendId;
//    }
//
//    public void setSendId(String _sendId) {
//        this._sendId = _sendId;
//    }

    public String getAid() {
    	System.out.println("JobData:getAid() = " + aid);
        return aid;
    }

    public void setAid(String aid) {
    	System.out.println("JobData:setAid() = " + aid);
        this.aid = aid;
    }
    
    public JobState getJobState() {
    	return jobState;
    }

    public void setJobState(JobState jobState) {
    	this.jobState = jobState;
    }
    
    public int getId() {
    	return id;
    }

    public int compareTo(JobData jobData) {
	    	return this.id < jobData.id ? -1 : 1;
	}
}
